import QtQuick
import QtQuick.Layouts
import QtQuick.Controls

import "." as QML
import "./table.js" as Func

Window{
    width: 500
    height: 500

    visible: true

    Rectangle{
        id:btn
        width: parent.width
        height: 50

        anchors.top: parent.top
        anchors.horizontalCenter: parent.horizontalCenter

        Row{
            spacing: 20
            anchors.fill: parent

            Button{
                text: qsTr("合并单元格")
                onClicked:
                {
                    Global.mergeCells()
                }

            }

            Button{
                text: qsTr("取消合并单元格")
                onClicked: Global.unmergeCells()
            }
        }
    }

    QML.Popup{
        id:popup
        anchors.top: btn.bottom

        //连接抛出错误信号到槽
        Component.onCompleted: {
            Global.thowException.connect(popup.appendToHead)
        }
    }

    QML.Table{
        anchors.top: popup.bottom
        Component.onCompleted: console.log("表格加载完成")
    }


}
